package com.yang.newCustomersTransferBackProcess.dao;

import com.yang.newCustomersTransferBackProcess.pojo.CirculationDataExtraction;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface CirculationDataExtractionDao extends JpaRepository<CirculationDataExtraction, Integer>, JpaSpecificationExecutor<CirculationDataExtraction> {

    @Query(value = "select * from circulation_data_extraction where customer_id = ?1 and created_at > DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 7 DAY),'%Y-%m-%d %H:%i:%s');", nativeQuery = true)
    CirculationDataExtraction findCirculationDataExtraction( int customerId);
}
